﻿using oceanho.webapi.factory.httpAttr;
using oceanho.webapi.factory.httpHandler;
using oceanho.webapi.factory.Tests.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace oceanho.webapi.factory.Tests.serviceHandlers
{
    /// <summary>
    /// 定义一个用于演示所有提交数据接收绑定的handler演示类，继承自 http_service_handler
    /// </summary>
    public class Tests_ServiceHandler : http_service_handler
    {
        private StringBuilder _build = new StringBuilder();

        /// <summary>
        /// 测试xml
        /// </summary>
        /// <param name="_xml_user">参数名称有讲究哦（以 _xml_ 开始）</param>
        [Router("submit-xml")]
        public void Submit_Xml(User _xml_user)
        {
            _build.AppendFormat("测试Xml提交参数绑定，收到了数据如下：<br/>");
            if (_xml_user != null)
            {
                _build.AppendFormat("id:" + _xml_user.id + " -> name:" + _xml_user.name + " -> age:" + _xml_user.age);
            }
            base.Html(_build.ToString());
        }
    }
}